package com.jcli.util._获取并保存窗体大小;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class YourMainClass {

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            JFrame frame = new JFrame("Your Window Title");
            // ... other initialization code ...

            // Apply the saved window size
            WindowSizeManager.applyWindowSize(frame);

            // ... other code ...

            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);

            // Save the window size when it's closed
            frame.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    WindowSizeManager.saveWindowSize(frame);
                }
            });
        });
    }
}
